﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BALayer;

namespace PGBT
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            NguoiDung db = new NguoiDung();

            if (db.DangNhap(txtUsername.Text.ToString(), txtPassword.Text.ToString()))
            {
                Close();
            }
            else
            {
                MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUsername.Focus();
            }
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Thoát chương trình ?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if(result == DialogResult.OK)
            {
                Application.Exit();
            }
        }

        private void cauHinhHeThongToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new CauHinhHeThong().ShowDialog();
        }
    }
}
